<template>
    <div class="pwd-div">
        <div class="pwd">
            <el-input v-model="input" style="width: 240px" placeholder="请输入密码" />

            <el-button type="primary" @click="login">登录</el-button>
        </div>
    </div>
</template>

<script setup>
import router from "@/router";
import store from "@/store";
import {getCurrentPwd} from "@/utils/json";
import {ref} from "vue";
const input = ref("");

const login = () => {
    let pwd = getCurrentPwd();
    if (input.value == pwd) {
        store.commit("updateToken", pwd);
        router.push("/home");
    }
};
</script>

<style lang="scss" scoped>
.pwd-div {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 100px;
    .pwd {
        width: 500px;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        .el-button {
            margin-top: 50px;
        }
    }
}
</style>
